using AiQiuQuan.Sport.Model.Models;
using AiQiuQuan.Sport.Core;
using AiQiuQuan.Sport.WebApi.Services;
using Microsoft.AspNetCore.Mvc;

namespace AiQiuQuan.Sport.WebApi.Controllers
{
    /// <summary>
    /// 用户积分管理
    /// </summary>
    public class BaseUserPointController : ApiController
    {
        private readonly IBaseUserPointService _baseUserPointService;

        /// <summary>
        /// 用户积分管理
        /// </summary>
        public BaseUserPointController(
            IBaseUserPointService baseUserPointService
            )
        {
            _baseUserPointService = baseUserPointService;
        }

        /// <summary>
        /// 查询
        /// </summary>
        /// <param name="id">业务编号</param>
        [HttpGet("get/{id}")]
        public async Task<UnaryResult<BaseUserPointDto>> GetAsync(Guid id)
        {
            var result = await _baseUserPointService.GetAsync(id);
            return UnaryResult.Succeed(result);
        }

        /// <summary>
        /// 修改
        /// </summary>
        [HttpPost("update")]
        public async Task<UnaryResult> UpdateAsync(BaseUserPointUpdateDto model)
        {
            var result = await _baseUserPointService.UpdateAsync(model);
            return result;
        }

        /// <summary>
        /// 删除
        /// </summary>
        [HttpPost("delete")]
        public async Task<UnaryResult> DeleteAsync(Guid id)
        {
            var result = await _baseUserPointService.DeleteAsync(id);
            return result;
        }
    }
}
